package com.gitee.kobe577590.validator;

import java.util.ArrayList;
import java.util.List;

import com.gitee.kobe577590.validator.exception.ValidateException;



public class Validator {
    public List<AbstractRule> rules = new ArrayList<AbstractRule>();

    public Validator addRule(AbstractRule rule) {
        rules.add(rule);
        return this;
    }

    public boolean excute() throws ValidateException {

        for (AbstractRule rule : rules) {

            rule.validate();
        }
        return true;
    }
}
